package future.basic;

public class Client {

    public Data request(String queryStr) {
        FutureData future = new FutureData();
        new Thread(() -> {
            RealData realData = new RealData(queryStr);
            future.setRealData(realData);
        }).start();
        return future;
    }

    public static void main(String[] args) throws InterruptedException {
        Client client = new Client();
        Data data = client.request("name");
        System.out.println("任务提价成功");
        Thread.sleep(1000);
        System.out.println("数据=" + data.getResult());
    }
}
